<?php
/**
 *  当前模板用到的相关函数
*/
function getDztShopList()
{
	global $_FANWE;
	$cid = (int)$_FANWE['request']['cid'];
	if($cid > 0 && isset($_FANWE['cache']['shops']['all'][$cid]))
	{
		$cate = $_FANWE['cache']['shops']['all'][$cid];
		$_FANWE['nav_title'] = $cate['name'].$_FANWE['nav_title'];
		if(isset($cate['childs']))
	{
			$cate['childs'][] = $cid;
			$where .= ' AND cate_id IN ('.implode(',',$cate['childs']).')';
		}
		else
			$where .= ' AND cate_id = '.$cid;
	}else{
		$cid=0;
	}
	$args = array();
	$args['cid']=$cid;
	$args['shop_list'] = FDB::fetchAll('SELECT * FROM '.FDB::table('shop').' WHERE shop_logo > 0'.$where.' and is_show=\'1\' ORDER BY sort ASC, shop_id asc limit 0,26 ');
	return tplFetch('inc/shop/dzt_shop_list',$args,'','');
}

function getDztShopNewestShare(){
	$args = array();
	$cache_file = getTplCache('inc/shop/newest_share',array(),1);
	if(getCacheIsUpdate($cache_file,600))
	{
		//global $_FANWE;
		$s['share_list']=FDB::fetchAll('SELECT s.*,sg.shop_id FROM '.FDB::table('share').' as s inner join '.FDB::table('share_goods').' as sg on s.share_id=sg.share_id WHERE s.share_data=\'goods\' order by s.share_id desc limit 0,7 ');
		$args['share_list']=FS("Share")->getShareDetailList($s['share_list']);
	}
	return tplFetch('inc/shop/newest_share',$args,'',$cache_file);	
}
?>